package cn.com.bluemoon.daps.common.datascope.config;

import cn.com.bluemoon.daps.common.datascope.BmVPN;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.Collections;
import java.util.Set;

/**
 * bmVPN的全局配置
 * 与{@link BmVPN#openIPAddress()}功能类似，区别是BmVPN是接口级别的控制
 *
 * @author Jarod.Kong
 */
@ConfigurationProperties(prefix = "bm.vpn.http")
@Configuration
@ConditionalOnProperty(
        value = {"bm.vpn.http.enabled"},
        matchIfMissing = true
)
public class BmVPNProperties {
    /**
     * 全局开放的ip
     */
    private Set<String> openIpAddress;

    public Set<String> getOpenIpAddress() {
        if (openIpAddress == null) {
            return Collections.emptySet();
        }
        return openIpAddress;
    }

    public void setOpenIpAddress(Set<String> openIpAddress) {
        this.openIpAddress = openIpAddress;
    }
}
